#设置cmake最低版本
cmake_minimum_required(VERSION 3.4.1)

#设置项目名称
project(tst_qtbase_auto_network)

#引入add_module模板文件
include(${ISSQTTESTROOTDIR}/cmake/add_module.cmake)

#设置测试类型，auto为自动测试，manual为手动测试,即test目录下的文件夹名
set(TEST_TYPE auto)
#设置模块名
set(MODULE qtbase)
#设置需要链接的模块
set(LinkQt Core Gui Widgets Network Concurrent OpenGL Sql Svg Quick Xml PrintSupport)
#设置需要链接的模块的私有模块
set(LinkQtPrivate Core Test Gui Widgets Sql Network OpenGL Concurrent PrintSupport)

add_definitions("-DQT_DISABLE_DEPRECATED_BEFORE=0"
                "-DSRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\"")
get_filename_component(CMAKE_NATIVE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM} NAME)
add_definitions(-DDEFAULT_MAKESPEC="${CMAKE_NATIVE_MAKE_PROGRAM}")


set(CodeRootPath ${ISSQTTESTROOTDIR}/qtbase)
include_directories(${CodeRootPath}/3rdparty/tinycbor/src
                    ${CodeRootPath}/3rdparty/tinycbor/tests
                    ${CodeRootPath}/3rdparty/tinycbor/tests/encoder
                    ${CodeRootPath}/3rdparty/tinycbor/tests/parser
                    ${CodeRootPath}/tests/auto/other/qvariant_common
                    ${CodeRootPath}/tests/auto/corelib/kernel/qcoreapplication
                    ${CodeRootPath}/tests/baselineserver/shared
                    ${CodeRootPath}/tests/
                    ${CodeRootPath}/tests/auto/other/qabstractitemmodelutils
                    ${CodeRootPath}/tests/shared
                    ${CodeRootPath}/tests/auto/corelib/kernel/qmetatype)

#多级目录
set(TEST_ITEMS ${TEST_ITEMS}
    network/access/qabstractnetworkcache
    network/access/qnetworkaccessmanager
    network/access/qnetworkcachemetadata
    network/access/qnetworkcookie
    network/access/qnetworkcookiejar
    network/access/qnetworkdiskcache
    network/access/qnetworkreply
    network/access/qnetworkrequest
    network/bearer
    network/kernel
    network/socket

   #其他测试项需要
   other/qabstractitemmodelutils
)

#排出不需要的.cpp
set(EXCLUDE_SRC ${EXCLUDE_SRC}
    #private test
    network/access/hpack/tst_hpack.cpp
    network/access/hsts/tst_qhsts.cpp
    network/access/http2/http2srv.cpp
    network/access/http2/tst_http2.cpp
    network/access/qftp/tst_qftp.cpp
    network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
    network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp
    network/access/qnetworkreply/tst_qnetworkreply.cpp
    network/access/spdy/tst_spdy.cpp
    network/kernel/qauthenticator/tst_qauthenticator.cpp
    network/kernel/qhostinfo/tst_qhostinfo.cpp
    network/socket/platformsocketengine/tst_platformsocketengine.cpp
    network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
    network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
    network/socket/qsctpsocket/tst_qsctpsocket.cpp
    network/socket/qtcpsocket/tst_qtcpsocket.cpp
    #none app
    network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp
    network/bearer/qnetworkconfigurationmanagerqappless/tst_qnetworkconfigurationmanagerqappless.cpp
)

add_sources(
    gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp
    corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp
)

#0为使用widget_main，1为使用gui_main,2使用core_main,3使用appless_main，4或其他使用none_main
set(MANUAL_ADD_MAIN 2)

set(PLUGINS QOpenHarmonyPlatformIntegrationPlugin)
#再把TEST_ITEMS传给create_library整合测试项，生成测试库
#整合测试项，生成测试库，名字当前工程名，即project(tst_qtcharts_auto)中定义的tst_qtcharts_auto
create_library(${TEST_ITEMS})

